#ifndef LEXER_H
#define LEXER_H

#include <cstring>

template <unsigned bufferLength>
class Lexer
{
	char lexemeBuffer_[bufferLength];
	unsigned lexemeLength_;
protected:
	Lexer()
	{
		resetLexeme();
	}
	void resetLexeme()
	{
		memset(lexemeBuffer_, 0, bufferLength);
		lexemeLength_ = 0;
	}
	bool addCharToLexeme(char c)
	{
		if (lexemeLength_ + 1 >= bufferLength)
			return false;
		lexemeBuffer_[lexemeLength_] = c;
		lexemeLength_++;
		return true;
	}
public:
	const char *getLastLexeme() const
	{
		return lexemeBuffer_;
	}
};

#endif
